package edu.corn.job.core.engine;

import edu.corn.job.core.statemachine.JobStateUtil;

import java.util.concurrent.ExecutorService;

public class AsyncJobEngine extends JobEngine {
    /**
     * 线程池。
     */
    protected ExecutorService executorService;

    public AsyncJobEngine(ExecutorService executorService) {
        super();
        this.executorService = executorService;
    }

    @Override
    public ExecutorService getExecutorService() {
        return this.executorService;
    }

    @Override
    void doSubmit(JobRunner jobRunner) {
        // 立即提交。
        JobStateUtil.submit(jobRunner.getContext());
    }
}
